package tk.mynoteapp.dev.demo21.templatemethod.right;

import tk.mynoteapp.dev.demo21.templatemethod.Item;

import java.math.BigDecimal;

// 普通用户购物车
public class NormalUserCart extends AbstractCart {

    @Override
    void processCouponPrice(long userId, Item item) {
        // 无优惠
        item.setCouponPrice(BigDecimal.ZERO);
    }

    @Override
    void processDeliveryPrice(long userId, Item item) {
        // 运费为商品总价的10%
        item.setDeliveryPrice(item.getPrice().multiply(BigDecimal.valueOf(item.getQuantity())).multiply(new BigDecimal("0.1")));
    }
}
